package com.cos.lession72.web.controller;

import com.cos.lession72.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: COS
 * @time: 2022/9/28 15:44
 * @description:
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    public String doLogin(String username,String password){
        String uname="admin";
        String pwd = "pwd";
        if (uname.equals(username)&&pwd.equals(password)) {
            System.out.println("登录成功");
        }else{
            System.out.println("登录失败");
        }
        return null;
    }
    @RequestMapping("/addUser")
    public String addUser(User user){
        System.out.println(user);
        return null;
    }
    /**
     *
     * @author: COS
     * @return:
     * @time: 2022/9/28 16:48
     * @description:
     * 路径参数
     */
    @RequestMapping("/getWorld/{world}")
    public String getWorld(@PathVariable("world") String world){
        System.out.println(world);
        return null;
    }

}
